#ifndef  __SELFTWORKLAYER_H__
#define  __SELFTWORKLAYER_H__

#ifdef   SELFTWORKLAYER_GLOBALS
#define  SELFTWORKLAYER_EXT
#else
#define  SELFTWORKLAYER_EXT  extern
#endif

#define GenFaultWay_Alarm                 DEF_BIT_00
#define GenFaultWay_Action                DEF_BIT_01
#define GenFaultWay_filtShutDown          DEF_BIT_02
#define GenFaultWay_ALL        (GenFaultWay_Alarm|GenFaultWay_Action|GenFaultWay_filtShutDown)

#define WorkFlowTimingFreq      10 //10hz

/*******************流程步骤**********************/
#define WorkflowStep_Entry                                0


/*******************计数器**********************/
SELFTWORKLAYER_EXT uint32_t CurrProcCountdown;//当前测试流程执行时间 *WorkFlowTimingFreq
SELFTWORKLAYER_EXT uint32_t CurrProcCountdownEnable;//当前测试流程执行时间使能
SELFTWORKLAYER_EXT uint32_t SMTimerCounter;   


// 定义回调函数类型
typedef uint8_t (*ShutDownAlarmCALLBACK)(uint8_t *TempWFStep, uint8_t *TempWFPeriod, uint8_t *WFStaChange, uint8_t Solution);

uint8_t SelfTimingWFWorkLayerHandle(uint8_t TempWorkflow,uint8_t* TempShareOutAlarm);

uint8_t FilterOverShutDownAlarm(uint8_t *TempOutAlarm,uint8_t* FilterTable);
uint8_t AlarmHandleRequestWorkLayerHandle(uint8_t TempWorkflow, uint8_t *ActInform,uint8_t* TempOutAlarm);
uint8_t SwitchAlarmStatusByTable(void *Pevent, uint8_t OperaType, uint8_t *TempOutAlarm, uint8_t *Table);
void UpdateWorkflowModeStatus(uint8_t *TempWorkflow, uint8_t *TempWFStep,uint8_t *TempWFPeriod,  uint8_t *WFStaChange);
void SetNewWorkFlowPeriodStatus(uint8_t *TempWFPeriod, uint8_t *WFStaChange, uint8_t NewPeriod);
void SetNewWorkFlowStepStatus(uint8_t *TempWFStep,uint8_t *TempWFPeriod, uint8_t *WFStaChange, uint8_t NewStep);
void SetNextNewWorkFlowStepStatus(uint8_t *TempWFStep,uint8_t *TempWFPeriod, uint8_t *WFStaChange, uint8_t MaxStep);
void SetNewWorkflowModeStatus(uint8_t *TempWorkflow, uint8_t *TempWFStep,uint8_t *TempWFPeriod,  uint8_t *WFStaChange, uint8_t NewMode);
uint8_t SwitchBefCheckStep(uint8_t TempWorkflow,uint8_t TempWFStep,uint8_t TempWFPeriod, uint8_t Step_Maximum,uint16_t EngineInitStart_time,uint16_t EngineInitSpeed,ShutDownAlarmCALLBACK ShutDownAlarmCallback);
#endif
